<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8">
	<title>房产模块-门店管理</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="format-detection" content="telephone=no">
	<link rel="stylesheet" href="${s.base}/js/layui/css/layui.css" media="all" />
	<link rel="stylesheet" href="${s.base}/css/base/base.css" media="all" /></head>

<body class="childrenBody">
<form class="layui-form">
	<input type="hidden" id="id" name="id" value="${hostShop.id}" />
	<div class="layui-form-item layui-row layui-col-xs12">
		<label class="layui-form-label">
			<span class="red">*</span>&nbsp;&nbsp;编号</label>
		<div class="layui-input-block">
			<input type="text" class="layui-input" name="number" value="${number}" placeholder="请输入编号" lay-verify="required|loginName" autocomplete="off" maxlength="6"/></div>
	</div>
	<div class="layui-form-item layui-row layui-col-xs12">
		<label class="layui-form-label">
			<span class="red">*</span>&nbsp;&nbsp;商店名称</label>
		<div class="layui-input-block">
			<input type="text" class="layui-input" name="shopName" value="${hostShop.shopName}" placeholder="请输入商店名称" lay-verify="required" autocomplete="off" /></div>
	</div>
	<div class="layui-form-item layui-row layui-col-xs12">
		<label class="layui-form-label">
			<span class="red">*</span>&nbsp;&nbsp;联系人</label>
		<div class="layui-input-block">
			<input type="text" class="layui-input" name="name" value="${hostShop.name}" placeholder="请输入联系人" lay-verify="required" autocomplete="off" /></div>
	</div>
	<div class="layui-form-item layui-row layui-col-xs12">
		<label class="layui-form-label">
			<span class="red">*</span>&nbsp;&nbsp;联系人手机</label>
		<div class="layui-input-block">
			<input type="text" class="layui-input" name="phone" value="${hostShop.phone}" placeholder="请输入联系人手机" lay-verify="required|phone" autocomplete="off" /></div>
	</div>

	<div class="layui-form-item layui-row layui-col-xs12">
		<div class="layui-input-block">
			<button class="layui-btn layui-btn-sm" lay-submit="" lay-filter="submitBtn">确定</button>
			<button type="reset" class="layui-btn layui-btn-sm layui-btn-primary cancel">取消</button></div>
	</div>
</form>
<script type="text/javascript" src="${s.base}/js/layui/layui.js"></script>
<script type="text/javascript" src="${s.base}/js/base/base.js"></script>
<script type="text/javascript">
	layui.use(['form', 'jquery', 'baseUtil', 'pageUtil','fileUtil','dialogUtil'],
    function() {
        var form = layui.form,
            $ = layui.jquery,
            dialogUtil = layui.dialogUtil,
            fileUtil = layui.fileUtil,
            baseUtil = layui.baseUtil,
            pageUtil = layui.pageUtil;

        var id = '${hostShop.id}';

        form.verify({
            loginName: function (value) {
                if (!verifyLoginName(value)) {
                    return "您输入的编号已存在,请重新输入";
                }
            }
        });

        function verifyLoginName(number) {
            var resCode=true;
            $.ajax({
                type : "post",
                url : "/hostShop/checkNumber",
                data : {id:id, number:number},
                async : false,
                success : function(data){
                    if (data.code == 0){
                        resCode=false;
                    }
                }
            });
            if(!resCode){
                return false;
            }
            return true;
        }

        form.on('submit(submitBtn)',
            function(data) {
                baseUtil.postMethodResult("/hostShop/addOrUpdate", data.field,
                    function(result) {
                        parent.location.reload();
                    });
                return false;
            });
    });</script>
</body>

</html>